//
//  menuPage.m
//  HiddenTouch
//
//  Created by 한솔 이 on 12. 8. 28..
//  Copyright 2012년 __MyCompanyName__. All rights reserved.
//

#import "menuPage.h"
#import "playPage.h"

@implementation menuPage
+(CCScene *) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	menuPage *layer = [menuPage node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
	// return the scene
	return scene;
}


-(id) init
{
	if( (self=[super init]) ) {        
                
        CCMenuItem *menu1 = [CCMenuItemImage itemFromNormalImage:@"btn-play-normal.png" selectedImage:@"btn-play-selected.png" target:self selector:@selector(menuTouch:)];
        CCMenuItem *menu2 = [CCMenuItemImage itemFromNormalImage:@"btn-highscores-normal.png" selectedImage:@"btn-highscores-selected.png" target:self selector:@selector(menuTouch:)];
        CCMenuItem *menu3 = [CCMenuItemImage itemFromNormalImage:@"btn-about-normal.png" selectedImage:@"btn-about-selected.png" target:self selector:@selector(menuTouch:)];
        
        CCMenu *menu = [CCMenu menuWithItems:menu1,menu2,menu3, nil];
        menu.position = ccp(240, 160);
        [menu alignItemsHorizontally];
        
        [self addChild:menu];
        
        menu1.tag = 1;
        menu2.tag = 2;
        menu3.tag = 3;
        
	}
	return self;
}


- (void) menuTouch: (id)sender{
    CCMenuItem *tmenu = (CCMenuItem *)sender;
    
    if (tmenu.tag == 1) {
        CCScene *goPlay = [CCTransitionFade transitionWithDuration:2 scene:[playPage scene]];
        [[CCDirector sharedDirector] replaceScene:goPlay];
    } else if (tmenu.tag == 2) {
        NSLog(@"준비중2");
    } else if (tmenu.tag == 3) {
        NSLog(@"준비중3");
    }
    
}



@end
